﻿@model PagedList.IPagedList<MvcAtletIS.Models.Articles>
@{
    ViewBag.Title = "Slovenský atletický zväz";
}
@section head {

    <!-- Slidorion -->
    <link href="@Url.Content("~/Content/css/news.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.slidorion.min.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#slidorion").slidorion({
                interval: 5000,
                effect: "random"
            });
        });
	</script>
}
    
    <!-- SIDEBAR -->
    <div id="sidebar">

        <div class="sidebar-box-title">
            Fotogaléria
        </div>
        <div class="sidebar-box-image">
            <a href="/Home/PhotoGallery">
                <img src="@Url.Content("~/Content/logos/FOTO.png")" alt="Fotogaléria" width="146px" />
            </a>
        </div>

        <div class="sidebar-box-title">
            Videogaléria
        </div>
        <div class="sidebar-box-image">
            <a href="/Home/VideoGallery">
                <img src="@Url.Content("~/Content/logos/video.png")" alt="Fotogaléria" width="146px" />
            </a>
        </div>
        
        @foreach (var linksCategory in ViewBag.LinksCategories) 
        { 
            <div class="sidebar-title">
                @linksCategory.Name
            </div>
            
            foreach (var link in ((IEnumerable<MvcAtletIS.Models.Links>)ViewBag.Links).Where(l => l.CategoryId == linksCategory.ID).OrderBy(l => l.Order))
            { 
                <div class="sidebar-box-title">
                    @link.Name
                </div>
            
                string sAdress = "http://" + link.Adress;
                <div class="sidebar-box-image">
                    <a href="@sAdress" target="_blank">
                        <img src="@Url.Content("~/Content/logos/" + link.LogoPath)" alt="@link.Name" width="146px" />
                    </a>
                </div>
            }
        }

    </div>

    <!-- CONTENT -->
    <div id="content">
    
        <!-- TOP ARTICLES -->
        <div id="slidorion">
            <div id="slider">
            @{
                int i = 1;
                foreach (var topArticle in ViewBag.TopArticles)
                {
                    string id = "slide" + i.ToString();
                    string image = topArticle.ImagePath;
                    
                    <div id="@id" class="slide">
				        <a href="/Articles/Detail?ArticleId=@topArticle.ID"><img src="@Url.Content("~/Content/articles/" + image)" alt="@id" width="488" height="375" /></a>
                    </div>
                    
                    i += 1;
                }
            }
            </div>
            <div id="accordion">
            @{
                foreach (var topArticle in ViewBag.TopArticles)
                { 
                    <div class="link-header"> @topArticle.Title </div>
                    <div class="link-content">
                        <p> 
                            @topArticle.Perex
                            @Html.ActionLink("Viac", "Detail", "Articles", new { ArticleId = topArticle.ID }, null) 
                        </p>
                    </div>
                }
            }
            </div>
        </div>

        <!-- INFO BOX -->
        @if (!string.IsNullOrEmpty(ViewBag.InfoBox))
        {
            <div id="info-box">
                <h5>Infopanel</h5>
                <div id="info-box-text">
                    @Html.Raw(ViewBag.InfoBox)
                </div>
            </div>
        }
        
        <div id="next-articles"><a href="/Home/VideoGallery">Videogaléria</a></div>
        <div class="video-gallery-box">
        @foreach (var item in ViewBag.VideoGallery)
        { 
            <div class="video-box-small">
                <iframe style="width:100%;  border:0;" src="http://@item.Perex"></iframe>
            </div>
        }
        </div>

        <div class="paging-box">
    
            @if (Model.HasPreviousPage)
            {
                @Html.ActionLink("<<", "Index", new { page = 1 })
                @Html.Raw(" ");
                @Html.ActionLink("<", "Index", new { page = Model.PageNumber - 1 })
            }

            Strana @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) z @Model.PageCount
     
            @if (Model.HasNextPage)
            {
                @Html.ActionLink(">", "Index", new { page = Model.PageNumber + 1 })
                @Html.Raw(" ");
                @Html.ActionLink(">>", "Index", new { page = Model.PageCount })
            }
        
        </div>

        <!-- NEXT ARTICLES -->
        @foreach (var commonArticle in Model)
        { 
            <div class="article">
                <div id="next-articles">
                    @commonArticle.Title
                </div>
                
                <div class="article-image">
                    <img src="@Url.Content("~/Content/articles/" + commonArticle.ImagePath)" alt="commonArticle.Name" width="300px" />
                
                    @if (!string.IsNullOrEmpty(commonArticle.ImageText))
                    {
                    <p>
                        @Html.Raw(commonArticle.ImageText)
                    </p>
                    }
                </div>
                
                <p class="article-perex">
                    @commonArticle.Perex
                </p>
                
                <p class="article-text">
                    <b>
                    @commonArticle.City
                    @commonArticle.Date.Value.ToLongDateString()
                    (@commonArticle.Editor)
                    </b>
                    @Html.Raw(commonArticle.Text)
                    
                </p>
            </div>
        }
    
    <div class="paging-box">
    
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Index", new { page = 1 })
        @Html.Raw(" ");
        @Html.ActionLink("<", "Index", new { page = Model.PageNumber - 1 })
    }

    Strana @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) z @Model.PageCount
     
    @if (Model.HasNextPage)
    {
        @Html.ActionLink(">", "Index", new { page = Model.PageNumber + 1 })
        @Html.Raw(" ");
        @Html.ActionLink(">>", "Index", new { page = Model.PageCount })
    }
        
</div>
    
    </div>




